package com.monkey.controller;

import com.monkey.service.CategoryService;
import com.monkey.vo.Results;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author：monkey-L
 * @description: .
 * @date: 17:00 2021/10/6
 */
@RestController
@RequestMapping("categorys")
@SuppressWarnings({"all"})
public class CategoryController {

    @Autowired
    private CategoryService categoryService;

    @GetMapping
    public Results categories(){
        return categoryService.findAll();
    }

    @GetMapping("detail")
    public Results categoriesDetail(){
        return categoryService.findAllDetail();
    }

    @GetMapping("detail/{id}")
    public Results categoryDetailById(@PathVariable Long id){
        return categoryService.categoryDetailById(id);
    }
}
